package org.swan.web.user.mapper;

import org.apache.ibatis.annotations.*;
import org.swan.web.user.bean.UserRoleBean;
import java.util.List;
import java.util.Optional;


public interface UserRoleMapper {
    @Insert("insert into user_role ( user_id , role_id , consignor_id , create_time ) VALUES ( #{userId} , #{roleId} , #{consignorId} , #{createTime})")
    @Options(useGeneratedKeys = true,keyProperty = "userRoleId")
    long add(UserRoleBean ub);
    @Select("select * from user_role where user_role_id = #{id}")
    Optional<UserRoleBean> getById(@Param("id") long id);
    @Update("update user_role set  where user_role_id = #{userRoleId}  ")
    long updateById(UserRoleBean UserRoleBean);
    @Delete("delete from user_role where user_role_id = #{UserRoleId}")
    long deleteById(@Param("UserRoleId") long UserRoleId);
    @Select("select * from user_role limit #{rows} offset #{offset}")
    List<UserRoleBean> list(@Param("offset") int offset,@Param("rows") int rows);
}
